<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            line-style:none;
        }

        .yiJu{
            position: absolute;
            /*绝对定位*/
            top: 80%;
            left: 50%;
            transform: translate(-50%, -50%);
        }

        .yiJu li{
            display: flex;
            height:80px;
            line-height: 80px;
        }

        .yiJu li span{
            font-size: 20px;
            font-weight: bold;
            color: red;
        }

        .yiJu li input{
            display: none;
            width: 200px;
            height: 50px;
            margin-top: 15px;
            color: green;
        }

        .yiJu li p{
            width:100px;
            height:25px;
            margin-left: 20px;
            border-radius: 25px;
            margin-top: 28px;
            font-size: 18px;
            line-height: 25px;
            text-align: center;
            cursor: pointer;
            color: white;
            background-color: #666666;
        }

        .yiJu li p.qr{
            display: none;
        }

        .yiJu li.active p.yj{ /*给p标签的父元素里添加一个类名active，当有这个类名的时候，每日一句隐藏*/
            display: none;
        }

        .yiJu li.active p.qr{ /*给p标签的父元素里添加一个类名active，当有这个类名的时候，确认出现*/
            display: block;
        }

        .yiJu li.active span{
            display: none;
        }

        .yiJu li.active input{
            display: block;
        }

    </style>
</head>
<body>
<ul class = "yiJu">
    <li>
        <span>每日一句</span>
        <input type = "text" value = "">
        <p class = "yj">每日一句</p>
        <p class = "qr">确定</p>
    </li>
</ul>

<script>
    let li1 = document.querySelector(".yiJu li")
    let span = document.querySelector(".yiJu li span")
    let input = document.querySelector(".yiJu li input")
    let yj = document.querySelector(".yiJu li .yj")
    let qr = document.querySelector(".yiJu li .qr")
    console.log(li1,span,input,yj,qr)

    yj.onclick = function (){

        //点击每日一句按钮就给li1添加类名active
        li1.classList.add("active")

        //将span里面的默认内容赋值给input
        input.value = span.innerText

    }

    qr.onclick = function (){

        //点击确认按钮就给li1移除类名active
        li1.classList.remove("active")

        //将input里面的内容赋值给span
        span.innerText = input.value
    }

</script>
</body>
</html>